/**
 * 
 */
package design_pattern.command.awt.undo;

import java.awt.Color;
import java.awt.Panel;
import java.awt.event.ActionEvent;

/**
 * @author linzq
 * 
 */
public class LetThreeBeLightCommand extends Command {

  public LetThreeBeLightCommand(String caption, Panel p) {
    super(caption, p);
  }

  @Override
  public void execute(ActionEvent e) {
    p.setBackground(Color.white);
    if (e.getSource() instanceof LetThreeBeLightCommand) {
      commands.push(this);
      index = 0;
    } else {
      index = 1;
    }
  }
}
